#!/bin/bash
while true
do
    sum=`iostat -x 1 6 | grep sda | tail -n5 | awk '{print $NF}' | cut -d . -f 1 | xargs | sed 's/ /+/g' | bc`
    n=$[$sum/5]
    if [ $n -gt 70 ]
    then
        echo "`date` %util is $n% " >> /tmp/mysql_processlist.log
        mysql -uroot -p123456 -h192.168.190.11 -e "show full processlist;" >>  mysql_processlist.log
    fi
    sleep 5
done
